#include "StdAfx.h"
#include "DrawDilation.h"
#include "../DlgSelect1.h"
#include "../OpenCVApp.h"



CDrawDilation::CDrawDilation(void)
	: m_SelectPos(1)
{
}


CDrawDilation::~CDrawDilation(void)
{
}
BEGIN_MESSAGE_MAP(CDrawDilation, CDrawOpenCV)
	ON_WM_PAINT()
	ON_WM_LBUTTONDOWN()
END_MESSAGE_MAP()


void CDrawDilation::DealwithFrame()
{
	// TODO: Add your command handler code here
	if(m_pFrame == NULL)
	{			
		return ;
	}
	if(m_pShow != NULL)
	{
		cvReleaseImage(&m_pShow);
	} 
	m_pShow= (IplImage *)cvClone(m_pFrame);
	cvDilate(m_pShow,m_pShow,0,m_SelectPos);
}


void CDrawDilation::OnLButtonDown(UINT nFlags, CPoint point)
{
	// TODO: Add your message handler code here and/or call default
	
	CSysLocalResource res(theApp.m_hInstance);	
	CDlgSelect1 dlgselect;
	dlgselect.SetSliderRang(1,255,m_SelectPos);
	if(dlgselect.DoModal() == IDOK)
	{
		m_SelectPos = dlgselect.GetSelectNum();
	}
	CDrawOpenCV::OnLButtonDown(nFlags, point);
}